﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent"
	xmlns:System="clr-namespace:System;assembly=mscorlib">
	
	<ControlTemplate TargetType="{x:Type Fluent:CheckBox}" x:Key="CheckBoxControlTemplate">
		   <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverRectangle">
                                            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
                                            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedRectangle">
                                            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.55" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIcon">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="IndeterminateIcon">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard />
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="16" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid HorizontalAlignment="Left" VerticalAlignment="Center">
                            <Grid x:Name="grid" Height="14" Width="14" Opacity="0.7">
                                <Rectangle x:Name="Background" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" />
                                <Rectangle x:Name="MouseOverRectangle" Stroke="#FF7F7F7F" Opacity="0" />
                                <Rectangle x:Name="PressedRectangle" Stroke="Black" Opacity="0" />
                                <Path Opacity="0"
                                      x:Name="CheckIcon"
                                      Data="M49.4375,110.4375 L51.4995,112.812 L56.3745,107.24883"
                                      HorizontalAlignment="Center"
                                      Height="7.6"
                                      Stretch="Fill"
                                      Stroke="#FF000000"
                                      Fluent:FrameworkHelper.UseLayoutRounding="False"
                                      VerticalAlignment="Center"
                                      Width="8.9"
                                      StrokeStartLineCap="Triangle"
                                      StrokeEndLineCap="Triangle"
                                      StrokeThickness="2" />
                                <Rectangle x:Name="IndeterminateIcon" Height="8" Width="8" Opacity="0">
                                    <Rectangle.Fill>
                                        <SolidColorBrush Color="#FF333333" />
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="DisabledVisualElement" Fill="White" Opacity="0" RadiusY="1" RadiusX="1" />
                            </Grid>
                            <Border x:Name="ValidationErrorElement"
                                      BorderBrush="#FFDB000C"
                                      BorderThickness="1"
                                      CornerRadius="1"
                                      Margin="1"
                                      Visibility="Collapsed">   
                                <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10">
                                    <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#DDD43940" Margin="0,3,0,0" />
                                    <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="White" Margin="0,3,0,0" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ContentControl Grid.Column="1" IsTabStop="False">
                            <ContentControl.Foreground>
                                <SolidColorBrush x:Name="ContentPresenterWrapperColor" Color="Black" />
                            </ContentControl.Foreground>
                            <ContentPresenter x:Name="contentPresenter"
                                RecognizesAccessKey="True"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Content="{TemplateBinding Header}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </ContentControl>
                    </Grid>
        </ControlTemplate>
  <Style x:Key="EmptyCheckBoxFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="CheckRadioFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
    <Style x:Key="RibbonCheckBoxStyle" TargetType="{x:Type Fluent:CheckBox}">
    <Setter Property="ToolTipService.ShowDuration" Value="30000"/>
    <Setter Property="Template" Value="{StaticResource CheckBoxControlTemplate}"/>
	<Setter Property="Background">
		<Setter.Value>
			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        		<GradientStop Color="{DynamicResource Gray5}" Offset="0"/>
        		<GradientStop Color="{DynamicResource WhiteColor}" Offset="1"/>
    		</LinearGradientBrush>
		</Setter.Value>
	</Setter>
    <Setter Property="Foreground" Value="Black"/>
	<Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="#FF7F7F7F" />
  </Style>

    <Style TargetType="{x:Type Fluent:CheckBox}" BasedOn="{StaticResource RibbonCheckBoxStyle}" />
</ResourceDictionary>